#include "timing.hpp"
#ifdef _WIN32
#include <windows.h>
#else
#include <time.h>
#endif

double tic() {
#ifdef _WIN32
    LARGE_INTEGER t, freq;
    QueryPerformanceFrequency(&freq);
    QueryPerformanceCounter(&t);
    return double(t.QuadPart) * 1000.0 / double(freq.QuadPart);
#else
    struct timespec t;
    clock_gettime(CLOCK_REALTIME, &t);
    return double(t.tv_sec) * 1000. + double(t.tv_nsec) / 1000000.;
#endif
}

double toc(double start) {
    return tic()-start;
}
